/* Author : Putri Andita R   091511059
 * Proyek 4*/

package jtk.project4.fleet.field;

import java.awt.FlowLayout;
import java.util.List;


import nl.coderight.jazz.form.FormField;
import nl.coderight.jazz.form.FormHeader;
import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormView;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.control.TabControl;
import nl.coderight.jazz.form.control.TabItem;
import nl.coderight.jazz.form.field.button.PushButton;

public class TabAssociationsField extends FormView{
	
	private TabControl associationsTab;
	private TabItem partAssociationsTab;
	private TabItem laborAssociationsTab;
	private TabItem procedureTab;
	
	

	
	@Override
	protected void init() {
		// TODO Auto-generated method stub
		setTitle("header.tabAssociations");
		createTabFields();		
		createLayout();
	}
	
	private void createLayout() {
		
		addField(createForm());
	}
	
		
		
	private void createTabFields()
	{
		associationsTab = new TabControl();
		partAssociationsTab = new TabItem("PartAssociations");
		laborAssociationsTab = new TabItem("LaborAssociations");
		procedureTab = new TabItem("Procedure");
	}
	
	private FormField createTabs()
	{
		TabControl form = associationsTab;
		form.addTab(partAssociationsTab, createPartAssociationsTab());
		form.addTab(laborAssociationsTab, createLaborAssociationsTab());
		form.addTab(procedureTab, createProcedureTab());
		return form;
	}
	
	
	
	private GroupControl createPartAssociationsTab() {
		GroupControl form = new GroupControl();
		form.setLayout(new FormLayout())	
		.addField(new PartRadioButtonField("PartRadioButton"))
		.addRow()
		.addField(new PartTableField("PartTable"))
		.addRow()
		.addField(new PartTombolField("PartTombolButton"));		
		return form;
	}
	
	private GroupControl createProcedureTab() {
		GroupControl form = new GroupControl();
		form.setLayout(new FormLayout())
		.addField(new ProcedureField("Procedure"))	
		;		
		return form;
	}
	
	private GroupControl createLaborAssociationsTab() {
		GroupControl form = new GroupControl();
		form.setLayout(new FormLayout())
		.addField(new LaborRadioButtonField("LaborRadioButton"))	
		.addRow()
		.addField(new LaborTableField("LaborTable"))
		.addRow()
		.addField(new LaborTombolField("LaborTombol"));
			
		return form;
	}
	
		
			
	
private FormField createForm()
{
	GroupControl form = new GroupControl();
	form.addField(createTabs());
	return form;
}



private GroupControl createGeneralForm() {
	GroupControl form = new GroupControl();
	form.addField(createGeneralForm(), NORTH);
	return form;
}
}
